<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:gx="generated" version="1.0">
  <xsl:namespace-alias stylesheet-prefix="gx" result-prefix="xsl"/>

  <xsl:template match="/generate">
    <gx:stylesheet version="1.0">
      <gx:template match="/">
        <xsl:choose>
          <xsl:when test="@type='html'">
            <html>
              <head>
                <title>
                  <gx:value-of select="//title"/>
                </title>
              </head>
              <body>
                <gx:copy-of select="//body/node()"/>
              </body>
            </html>
          </xsl:when>
          <xsl:otherwise>
            <xml>
              <gx:copy-of select="node()"/>
            </xml>
          </xsl:otherwise>
        </xsl:choose>
      </gx:template>
    </gx:stylesheet>
  </xsl:template>
</xsl:stylesheet>
